package ovm.entity;

import javax.persistence.*;

/**
 * Created by IntelliJ IDEA.
 * User: Jokser
 * Date: 26.05.12
 * Time: 8:15
 * To change this template use File | Settings | File Templates.
 */

@javax.persistence.Table(name = "CURRICULUM_SUBJECT", schema = "DBO_DIPLOM_NEW", catalog = "")
@Entity
public class CurriculumSubjectEntity {
    private CurriculumEntity curriculum;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "CURRICULUM", referencedColumnName = "ID", nullable = false)
    CurriculumEntity getCurriculum() {
        return curriculum;
    }

    public void setCurriculum(CurriculumEntity curriculum) {
        this.curriculum = curriculum;
    }

    private int credits;

    @javax.persistence.Column(name = "CREDITS")
    @Basic
    public int getCredits() {
        return credits;
    }

    public void setCredits(int credits) {
        this.credits = credits;
    }

    private int id;

    @javax.persistence.Column(name = "ID")
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CurriculumSubjectEntity that = (CurriculumSubjectEntity) o;

        if (credits != that.credits) return false;
        if (!curriculum.equals(that.curriculum)) return false;
        if (id != that.id) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = curriculum.hashCode();
        result = 31 * result + credits;
        result = 31 * result + id;
        return result;
    }

    private SemesterEntity semesterBySemester;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "SEMESTER", referencedColumnName = "ID", nullable = false)
    SemesterEntity getSemesterBySemester() {
        return semesterBySemester;
    }

    public void setSemesterBySemester(SemesterEntity semesterBySemester) {
        this.semesterBySemester = semesterBySemester;
    }

    private SubjectEntity subjectBySubject;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "SUBJECT", referencedColumnName = "ID", nullable = false)
    SubjectEntity getSubjectBySubject() {
        return subjectBySubject;
    }

    public void setSubjectBySubject(SubjectEntity subjectBySubject) {
        this.subjectBySubject = subjectBySubject;
    }

    private SubjectTypeEntity subjectTypeBySubjectType;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "SUBJECT_TYPE", referencedColumnName = "ID", nullable = false)
    SubjectTypeEntity getSubjectTypeBySubjectType() {
        return subjectTypeBySubjectType;
    }

    public void setSubjectTypeBySubjectType(SubjectTypeEntity subjectTypeBySubjectType) {
        this.subjectTypeBySubjectType = subjectTypeBySubjectType;
    }
}
